﻿using HNCSolutions.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace HNCSolutions.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult _Menu()
        {
            HNCSolutionsEntities container = new HNCSolutionsEntities();

            return PartialView(container.Menus.Where(mn => mn.TrangQuanTri.HasValue && !mn.TrangQuanTri.Value).ToList());
        }

        public PartialViewResult _SlideshowBanner()
        {
            Banner bannerTrangChu = new Banner { Action = "Index", Controller = "Home", ImagePath = "/Images/best_webdesign_template/Banner5.png" };
            Banner bannerGioiThieu = new Banner { Action = "About", Controller = "Home", ImagePath = "/Images/best_webdesign_template/Banner2.jpg" };
            Banner bannerLienHe = new Banner { Action = "Contact", Controller = "Home", ImagePath = "/Images/best_webdesign_template/banner3.jpg" };            

            return PartialView(new List<Banner> { bannerTrangChu, bannerGioiThieu, bannerLienHe});
        }

        public PartialViewResult _LinkFooter()
        {
            return PartialView(); 
        }

        public PartialViewResult _TinTuc()
        {
            return PartialView();
        }

        public PartialViewResult _SanPhamTieuBieu()
        {
            return PartialView();
        }

        public ActionResult Index()
        {
            HNCSolutionsEntities container = new HNCSolutionsEntities();
            TrangChuModel model = new TrangChuModel();
            model.LinhVucHoatDongList = container.DoanGioiThieuSets.ToList();
            model.ThongTinCongTy = container.CongTies.ToList()[0];
            ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application.";

            return View(model);
        }

        [Authorize()]
        public ActionResult About()
        {
            HNCSolutionsEntities container = new HNCSolutionsEntities();
            var thongTinCongTy = container.CongTies.ToList()[0];
            return View(thongTinCongTy);
        }

        public ActionResult Contact()
        {
            ViewBag.Message = "Your contact page.";

            return View();
        }
    }
}
